Class 5 Lab: Raster Calculator and Symbolization Strategies

Part I - Raster Symbolization

  • To start, download the lab data:

  • Lab Data 1

  • There are two raster datasets in the lab data part I. They originate as the Gridded Population of the World V4 (GPW) based on two temporal variables - 2010 and 2020. In this lab, the difference between the two datasets will be calculated and then mapped thematically as population change.

Gridded GPW Interface

  • Navigate to the the lab data folder, and import both rasters into QGIS:

Import Rasters to QGIS

  • Download the Value Tool plugin from main menu > plugins > value tool:

Value Tool Plugin

  • With both rasters loaded, install the tool and enable it in lower right of the map canvas. Find cell areas at/near a large urban area and move the tool over this geography. Notice that the values for 2010 will typically be smaller than 2020 representing urban population gain:

Value Tool Plugin

  • In this lab, this difference between 2010 and 2020 across both raster extents will be derived and mapped. Prior to calculating difference, symbolization will be explored.

  • Within the 2010 layer, navigate to layer properties > symbology. Choose Singleband pseudocolor renderer. Expand the Min / Max Value Settings and choose the Cumulative count cut option. The standard data range is set from 2% to 98% of the data values, meaning that the outliers will not be used to set the minimum and maximum values, resulting in a much more representative visualization. Typically this makes sense for visualization; however, when conducting analysis, keep in mind the actual data spread is important to the calculations.

Continuous Value Symbolization

  • Check your results:

Continuous Value Symbolization Result

  • Next, Copy the applied style in the 2010 layer, and apply Paste to the 2020 layer. Toogle the two layers ON/OFF; note the population gains at/near high population urban geographies:

  • Copy:

Copy Style

  • Paste:

Paste Style

  • Toogle Results:

Symbolization Result

Part II - Raster Calculator

  • Save project before moving to the calculations. Open the Raster Calculator via Main Menu > Raster > Raster Calculator:

Raster Calculator Interface

  • Within the Raster Calculator, bands are named after the raster name followed by @ and band number. Since each of our rasters have only 1 band, you will the names with @1 appended to the layer name. The calculation that will be utilized to derive change is simple raster math - in this case subtraction formatted as follows:

  • "gpw_v4_population_count_rev11_2020_2pt5_min@1" - "gpw_v4_population_count_rev11_2010_2pt5_min@1"

  • Output the layer as population_change_2010_2020.tif:

Raster Calculator

  • Visualize the results not with continuous values per se, but discrete values. Here we give a name/meaning to the colors beyond their quantitative position within the dataset. Four discrete values will be represented as unique colors, breaking the broad theme of population change into meaningful categories:

    • Decline | -100
    • Neutral | 100
    • Growth | 1000
    • High Growth | 1000000
  • Within the population_change_2010_2020.tif layer , navigate to layer properties > symbology. Choose Singleband pseudocolor renderer. Select the Interpolation method as Discrete. Remove any values using the minus button (red minus sign):

Discrete Symbolization Application

  • Each of the four discrete breaks will be entered manually. Start with Decline, setting the break to -100 and color to dark blue, then selecting Apply:

Discrete Breaks Applied

Note: only those values that fit the class of -100 are shown on the map canvas.

  • Continue to add the remaining 3 breaks, resulting in a thematic map for population change across the four categorical breaks:

Discrete Breaks Applied

  • Check the results:

Result

  • Zoom into larger scale geographies (the northeast US shown below) and notice population spatial patterns. ‘Rustbelt’ cities in the northeast US feature prominently in the Decline class:

Explore Results

Part III - Raster Import, Merging and Clipping:

  • Lab Data 3

  • While the previous lab utilized a continuous raster with global coverage, rasters with finer resolutions suitable to larger scale mapping are often organized as tile series. Tiles are typically merged into one layer for further analysis.

Raster Tiles prior to merge process

  • The Built virtual raster processing tool is utilized to merge tiles:

Build Virtual Raster

Tool Input using highest value and bilinear approach

  • Once built, the resulting raster layer can then be clipped to a custom study area using the Clip raster by mask layer processing tool:

Clip Raster

Input and Mask Layer

Clipped Result

Part IV - Raster Pyramids:

  • To Start, utilize the Virtual Raster from the previous as the input to generate pyramids:

Pyramids are used to improve display performance. They are a downsampled version of the original raster dataset and can contain many downsampled layers.

  • Pyramid creation happens within the raster properties. External format is the safest approach, and using the cubic method is appropriate for continuous values like DEM data:

Cubic Resampling for Raster Pyramids

Pyramids NOT applied prior to processing

Pyramids successfully applied

  • Once created, an .ovr file is created adjacent to the main raster layer; this is where the pyramid data is held ‘externally’. This can be checked in Properties as More information:

Applied Pyramids will appear under More information

Further Reference (Overview of Data utilzed for Part I and Part II:

  • Gridded Population of the World (GPW), v4 Introduction:

GPW Introduction